<title>编辑管理组</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>系统设置</cite></a>
    <a><cite>编辑管理组</cite></a>
  </div>
</div>

<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-card-header"><a lay-href="role/index" style="color: #990000;margin-right: 10px;">&lt;&lt; 返回上一级</a></div>
    <div class="layui-card-body">
    	
<form class="layui-form" action="{:url('/role/dorun')}" method="post">

  <input type="hidden" name="id" value="{$role.id}">

            <div class="layui-form-item">
              <label class="layui-form-label">角色名称</label>
              <div class="layui-input-inline">
              <script type="text/html" template>
                <input type="text" name="name" value="{$role.name}" lay-verify="required" autocomplete="off" class="layui-input">
              </script>
              </div>
            </div>
  <hr>
  
  {~$inar = explode(',',$role.auths);}
  {volist name="log" id="item"}
  <div class="layui-form-item">
    <label class="layui-form-label">{$item.title}</label>
    <div class="layui-input-block">
        {volist name="item.list" id="value"}
        	{if isset($value.list)}
        		{volist name="value.list" id="vars"}
        		<input class="cityId" type="checkbox" name="auths[]" lay-skin="primary" title="{$vars.title}" value="{$item.name}_{$vars.name}" {if in_array($item.name.'_'.$vars.name,$inar)}checked{/if}>
        		{/volist}
        	{else}
        	<input class="cityId" type="checkbox" name="auths[]" lay-skin="primary" title="{$value.title}" value="{$item.name}_{$value.name}" {if in_array($item.name.'_'.$value.name,$inar)}checked{/if}>
        	{/if}
        {/volist}
    </div>
  </div>

  {/volist}
  
            <div class="layui-form-item">
              <div class="layui-input-block">
                <input type="checkbox" lay-skin="primary" lay-filter="J_checkAll" title="全选">
                <button class="layui-btn" lay-submit lay-filter="J_ajax_submit_btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
              </div>
            </div>
            
          </form>
    </div>
  </div>
</div>
<script>
;!function(){
  var $ = layui.$
  ,form = layui.form;
  
  form.render();
    
    //监听复选框选择
    form.on('checkbox(J_checkAll)', function(obj){
        $('.cityId').prop('checked', this.checked);
        form.render('checkbox');
    });


}();
</script>